<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    class Person {
        age = 18

        constructor(name = 'hello') {
            this.name = name
        }

        sayName() {
            console.log(this.name)
        }
    }

    class Man extends Person {
        age = 20

        constructor(world) {
            // 调用父类构造函数
            super(world);
        }
    }

    console.log(new Man('world'));
</script>
</body>
</html>
